package demo;

import java.util.LinkedHashMap;
import java.util.Map;

import net.vsame.v.VSameHelper;

/**
 * 2012-12-2 上午11:41:50
 * @author <a href="mailto:gaollg@sina.com">Gaollg</a>
 */
public class Application {
	
	public static void main(String[] args) {
		Map<String, String[]> map = new LinkedHashMap<String, String[]>();
		map.put("question.id", new String[]{"aaaa"});
		map.put("question.name", new String[]{"gaollg@sina.com!"});
		map.put("age", new String[]{"100"});
		String[] roles = new String[]{
				"question.id @ $.length<3 @ 用户名长度有误 @ 请输入用户名(123456) @ 1111111111 @  正确@@"
		};
		
		String[] clazzRules = new String[]{
				"question.id @ $=='123456' @ 用户名长度有误===类 @ 请输入用户名(123456) @ 1111111111 @  正确@@",
				"question.name @ v('email', $) ",
				"age @ var age=parseInt($); return age<=100 && age>8;  @ 8-100 ",
		};
		Map<String, String> errors = VSameHelper.v(map, roles, clazzRules);
		System.out.println(errors);
	}

}

